// api/user.ts
import { http } from "@/services/http";
import type { ResponseData } from "@/types";

export function login(data: any) {
  return http.post<ResponseData>('/public/user/login', data);
}

export function loginPwd(data: any) {
  return http.post<ResponseData>('/public/user/login/pwd', data);
}

export function updateUserInfo(data: any) {
  return http.put<ResponseData>('/user', data);
}

export function updateUserPassword(data: any) {
  return http.put<ResponseData>('/user/password', data);
}

export function logout() {
  return http.get<ResponseData>('/user/logout');
}

export function getUserInfo() {
  return http.get<ResponseData>('/user/getUserInfo');
}

export function getUserInfoById(userId: any) {
  return http.get<ResponseData>('/user/getUserInfo/byId', { params: { userId: userId } });
}

export function getCode(data: any) {
  return http.get<ResponseData>('/public/getCheckCode', { params: { phone: data } });
}